package com.cs.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cs.anno.Log;
import com.cs.domain.SysLog;
import com.cs.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sys/log")
@Api(tags = "日志管理的接口")
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;

    /**
     * 分页查询的日志的接口
     */
    @ApiOperation(value = "分页查询的日志的接口")
    @GetMapping("/page")
    @PreAuthorize("hasAuthority('sys:log:page')")
    @Log(value = "分页查询的日志的接口")
    public ResponseEntity<Page<SysLog>> findLogPage(Page<SysLog> page, SysLog sysLog){
        Page<SysLog> sysLogPage=sysLogService.findLogPage(page,sysLog);
        return ResponseEntity.ok(sysLogPage);
    }
}
